package com.tuzhi.sys.service;

import com.tuzhi.base.service.BaseService;
import com.tuzhi.sys.jpa.entity.SysUserRoleEntity;
import com.tuzhi.sys.jpa.entity.pk.SysUserRolePk;

import java.util.Collection;
import java.util.List;

public interface SysUserRoleService extends BaseService<SysUserRoleEntity, SysUserRolePk> {

    /**
     * 查询指定用户ID的所有角色ID集合
     *
     * @param userId
     * @return
     */
    List<Long> listRoleId4UserId(Long userId);


    /**
     * 保存用户角色
     *
     * @param userId  用户ID
     * @param roleIds 角色ID集合
     */
    void saveUserRole(Long userId, Collection<Long> roleIds);

    int countByRoleId(Long roleId);

    int deleteByRoleId(Long roleId);

    int countByUserId(Long userId);

    int deleteByUserId(Long userId);


    //查询角色所有的用户id
    List<SysUserRoleEntity> listUserIdByRoleId(Long id);
}
